//
//  DoctorApplyInfoController.m
//  QuickCure37
//
//  Created by 马文星 on 16/6/20.
//  Copyright © 2016年 Demos. All rights reserved.
//

#import "DoctorApplyInfoController.h"
#import "DoctorApplyDTO.h"

@interface DoctorApplyInfoController ()


@property (nonatomic, strong) UIImageView *iconV;

//王先生
@property (nonatomic, strong) UILabel *patientNamelab;
@property (nonatomic, strong) UILabel *patientCaselab;
@property (nonatomic, strong) UILabel *patientTimelab;
@property (nonatomic, strong) UILabel *patientAppleylab;

@property (nonatomic, strong) UIView *lineV1;

//预约医生：
@property (nonatomic, strong) UILabel *applyDoctorlab;

@property (nonatomic, strong) UIView *lineV2;

//王医生
@property (nonatomic, strong) UILabel *doctorNameLab;
@property (nonatomic, strong) UILabel *doctor_class;
@property (nonatomic, strong) UILabel *hospitolLab;
@property (nonatomic, strong) UIButton *sendCallBackBtn;

@property (nonatomic, strong) UIView *lineV3;

//预约须知：
@property (nonatomic, strong) UILabel *applyKnown;

@property (nonatomic, strong) UIView *lineV4;

//就诊地点 标题
@property (nonatomic, strong) UILabel *t_addresslab;
@property (nonatomic, strong) UILabel *t_numberlab;
@property (nonatomic, strong) UILabel *t_getNumberAddresslab;

@property (nonatomic, strong) UILabel *addresslab;
@property (nonatomic, strong) UILabel *numberlab;
@property (nonatomic, strong) UILabel *getNumberAddresslab;

@property (nonatomic, strong) UIView *lineV5;


/** 短信重发 */
@property (nonatomic, strong) UIButton *reSendMsgBtn;

/** 取消预约 */
@property (nonatomic, strong) UIButton *cancelApplyBtn;

@end

@implementation DoctorApplyInfoController

- (void)viewDidLoad {
    [super viewDidLoad];

    [self setupUI];
}

- (void)setupUI{

    self.title = @"预约医生信息详情";
    [self setupCustomSubViews];
    
    [self setupLayouts];
}

/*!
 *  添加控件
 */
- (void)setupCustomSubViews{
    
    /*
     @property (nonatomic, copy) NSString *name; //王先生
     
     @property (nonatomic, copy) NSString *caseString;//高血压
     
     @property (nonatomic, copy) NSString *cureTimeString;//就诊时间
     
     @property (nonatomic, copy) NSString *doctor; //马医生
     
     @property (nonatomic, copy) NSString *doctor_calss;//主任医师
     
     @property (nonatomic, copy) NSString *hospitol; //北京协和医院
     
     @property (nonatomic, copy) NSString *cureState; //审核中
     */
    
//#warning  **************【 第一个模块 】**********************

    DoctorApplyDTO *dto = self.dto;

    //1.
    self.iconV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"banner"]];
    [self.view addSubview:self.iconV];
    self.iconV.layer.cornerRadius = 30;
    self.iconV.layer.masksToBounds = YES;
    
    //2.
    self.patientNamelab = [[UILabel alloc] init];
    [self.view addSubview:self.patientNamelab];
    self.patientNamelab.text = dto.name;
    self.patientNamelab.font  = FONT(18);
    
    //3.
    self.patientCaselab = [[UILabel alloc] init];
    [self.view addSubview:self.patientCaselab];
    self.patientCaselab.text = dto.caseString;
    self.patientCaselab.font  =FONT(17);
    self.patientCaselab.textColor = [UIColor lightGrayColor];
    self.patientCaselab.textAlignment = NSTextAlignmentCenter;

 
    //4.
    self.patientTimelab = [[UILabel alloc] init];
    [self.view addSubview:self.patientTimelab];
    self.patientTimelab.text = [NSString stringWithFormat:@"%@",dto.cureTimeString];
    self.patientTimelab.font  =FONT(17);
    self.patientTimelab.textColor = [UIColor lightGrayColor];

    //5.
    self.patientAppleylab = [[UILabel alloc] init];
    [self.view addSubview:self.patientAppleylab];
    self.patientAppleylab.text = dto.cureState;
    self.patientAppleylab.textColor = [UIColor whiteColor];
    self.patientAppleylab.backgroundColor  = RGBCOLOR(36, 122, 170);
    self.patientAppleylab.layer.cornerRadius = 30;
    self.patientAppleylab.layer.masksToBounds = YES;
    self.patientAppleylab.textAlignment = NSTextAlignmentCenter;
    
//#warning  **************【 第二个模块 】**********************

    //6.line
    self.lineV1 = [[UIView alloc] init];
    [self.view addSubview:self.lineV1];
    self.lineV1.backgroundColor = [UIColor lightGrayColor];

    //7.
    self.applyDoctorlab = [[UILabel alloc] init];
    [self.view addSubview:self.applyDoctorlab];
    self.applyDoctorlab.text = @"预约医生：";
    self.applyDoctorlab.font = FONT(20);
    self.applyDoctorlab.textColor = [UIColor lightGrayColor];
    
    //8.line
    self.lineV2 = [[UIView alloc] init];
    [self.view addSubview:self.lineV2];
    self.lineV2.backgroundColor = [UIColor lightGrayColor];


//#warning  **************【 第三个模块 】**********************
    
    //9.
    self.doctorNameLab = [[UILabel alloc] init];
    [self.view addSubview:self.doctorNameLab];
    self.doctorNameLab.text = dto.doctor;
    self.doctorNameLab.font = FONT(19);
    
    //10.
    self.doctor_class = [[UILabel alloc] init];
    [self.view addSubview:self.doctor_class];
    self.doctor_class.text = dto.doctor_calss;
    self.doctor_class.font = FONT(19);
    self.doctor_class.textColor = [UIColor lightGrayColor];
    
    //11.
    self.hospitolLab = [[UILabel alloc] init];
    [self.view addSubview:self.hospitolLab];
    self.hospitolLab.text = dto.hospitol;
    self.hospitolLab.font = FONT(18);
    self.hospitolLab.textColor = [UIColor lightGrayColor];
    
    //12.
    self.sendCallBackBtn = [[UIButton alloc] init];
    [self.sendCallBackBtn setTitle:@"递交反馈" forState:UIControlStateNormal];
    [self.view addSubview:self.sendCallBackBtn];
    self.sendCallBackBtn.backgroundColor  = kThemeColor;
    self.sendCallBackBtn.layer.cornerRadius = 3;
    self.sendCallBackBtn.layer.masksToBounds = YES;
    [self.sendCallBackBtn addTarget:self action:@selector(clickBtn:) forControlEvents:UIControlEventTouchUpInside];
    self.sendCallBackBtn.tag = 103;
    
    
//#warning  **************【 第四个模块 】**********************
    //13.line
    self.lineV3 = [[UIView alloc] init];
    [self.view addSubview:self.lineV3];
    self.lineV3.backgroundColor = [UIColor lightGrayColor];


    //14.
    self.applyKnown = [[UILabel alloc] init];
    [self.view addSubview:self.applyKnown];
    self.applyKnown.text = @"预约须知：";
    self.applyKnown.font = FONT(20);
    self.applyKnown.textColor = [UIColor lightGrayColor];
    
    //15.line
    self.lineV4 = [[UIView alloc] init];
    [self.view addSubview:self.lineV4];
    self.lineV4.backgroundColor = [UIColor lightGrayColor];

//#warning  **************【 第五个模块 】**********************

    //1.
    self.t_addresslab = [[UILabel alloc] init];
    [self.view addSubview:self.t_addresslab];
    self.t_addresslab.text = @"就诊地点：";
    self.t_addresslab.font = FONT(18);


    //2.
    self.t_numberlab = [[UILabel alloc] init];
    [self.view addSubview:self.t_numberlab];
    self.t_numberlab.text = @"取号时间：";
    self.t_numberlab.font = FONT(18);


    //3.
    self.t_getNumberAddresslab = [[UILabel alloc] init];
    [self.view addSubview:self.t_getNumberAddresslab];
    self.t_getNumberAddresslab.text = @"取号地址：";
    self.t_getNumberAddresslab.font = FONT(18);

    
    //4.
    self.addresslab = [[UILabel alloc] init];
    [self.view addSubview:self.addresslab];
    self.addresslab.text  = @"上海长征医院2号楼心血管内科";
    self.addresslab.textColor = [UIColor lightGrayColor];
    self.addresslab.font = FONT(18);

    
    //5.
    self.numberlab = [[UILabel alloc] init];
    [self.view addSubview:self.numberlab];
    self.numberlab.textColor = LIGHT_GRAY_COLOR;
    self.numberlab.text = @"9:00 - 10:00";
    self.numberlab.font = FONT(18);

    
    //6.
    self.getNumberAddresslab = [[UILabel alloc] init];
    [self.view addSubview:self.getNumberAddresslab];
    self.getNumberAddresslab.textColor = LIGHT_GRAY_COLOR;
    self.getNumberAddresslab.text = @"上海长征医院住院部";
    self.getNumberAddresslab.font = FONT(18);

    //7.line
    self.lineV5 = [[UIView alloc] init];
    [self.view addSubview:self.lineV5];
    self.lineV5.backgroundColor = [UIColor lightGrayColor];
    
//#warning  **************【 第六个模块 】**********************
    
    self.reSendMsgBtn = [[UIButton alloc] init];
    [self.reSendMsgBtn setTitle:@"短信重发" forState:UIControlStateNormal];
    [self.reSendMsgBtn setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.reSendMsgBtn addTarget:self action:@selector(clickBtn:) forControlEvents:UIControlEventTouchUpInside];
    self.reSendMsgBtn.tag = 101;
    [self.view addSubview:self.reSendMsgBtn];
    self.reSendMsgBtn.layer.cornerRadius = 4;
    self.reSendMsgBtn.layer.masksToBounds = YES;
    self.reSendMsgBtn.layer.borderColor = kThemeColor.CGColor;
    self.reSendMsgBtn.layer.borderWidth = 1.0;
    
    
    
    self.cancelApplyBtn = [[UIButton alloc] init];
    [self.cancelApplyBtn setTitle:@"取消预约" forState:UIControlStateNormal];
    [self.cancelApplyBtn setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.cancelApplyBtn addTarget:self action:@selector(clickBtn:) forControlEvents:UIControlEventTouchUpInside];
    self.cancelApplyBtn.tag = 102;
    [self.view addSubview:self.cancelApplyBtn];
    self.cancelApplyBtn.layer.cornerRadius = 4;
    self.cancelApplyBtn.layer.masksToBounds = YES;
    self.cancelApplyBtn.layer.borderColor = kThemeColor.CGColor;
    self.cancelApplyBtn.layer.borderWidth = 1.0;

}


/*!
 *  约束布局
 */
- (void)setupLayouts{
    
//#warning  **************【 第一个模块 90】**********************
    [self.iconV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(64+15);
        make.size.mas_equalTo(CGSizeMake(60, 60));
    }];
    
    [self.patientNamelab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.iconV.mas_right).offset(15);
        make.height.mas_equalTo(30);
        make.top.equalTo(self.iconV);
    }];
    
    [self.patientCaselab mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.patientNamelab.mas_right).offset(15);
        make.height.mas_equalTo(30);
        make.top.equalTo(self.iconV);
    }];
    
    [self.patientTimelab mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.iconV.mas_right).offset(15);
        make.height.mas_equalTo(30);
        make.bottom.equalTo(self.iconV);
    }];
    
    [self.patientAppleylab mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.mas_equalTo(-20);
        make.size.mas_equalTo(CGSizeMake(60, 60));
        make.centerY.equalTo(self.iconV);
    }];
//#warning  **************【 第二个模块 】**********************

    [self.lineV1 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.iconV.mas_bottom).offset(15);
        make.left.right.mas_equalTo(0);
        make.height.mas_equalTo(1);
        
    }];
    
    [self.applyDoctorlab mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.height.mas_equalTo(45);
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(self.lineV1.mas_bottom);
    }];
    
    
    [self.lineV2 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.applyDoctorlab.mas_bottom);
        make.left.right.mas_equalTo(0);
        make.height.mas_equalTo(1);
    }];
    
//#warning  **************【 第三个模块 】**********************

    [self.doctorNameLab mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(15);
        make.height.mas_equalTo(35);
        make.top.mas_equalTo(self.lineV2.mas_bottom).offset(10);
    }];
    
    [self.doctor_class mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.doctorNameLab.mas_right).offset(20);
        make.height.mas_equalTo(35);
        make.top.equalTo(self.doctorNameLab);
    }];
    
    [self.hospitolLab mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(15);
        make.height.mas_equalTo(35);
        make.top.mas_equalTo(self.doctorNameLab.mas_bottom);
    }];
    
    [self.sendCallBackBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.mas_equalTo(-20);
        make.size.mas_equalTo(CGSizeMake(80, 40));
        make.top.mas_equalTo(self.lineV2.mas_bottom).offset(25);
        
    }];
    
//#warning  **************【 第四个模块 】**********************
    
    [self.lineV3 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.hospitolLab.mas_bottom).offset(10);
        make.left.right.mas_equalTo(0);
        make.height.mas_equalTo(1);
    }];
    
    [self.applyKnown mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.height.mas_equalTo(45);
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(self.lineV3.mas_bottom);
    }];
    
    
    [self.lineV4 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.applyKnown.mas_bottom);
        make.left.right.mas_equalTo(0);
        make.height.mas_equalTo(1);
    }];
    
    
//#warning  **************【 第五个模块 】**********************

    [self.t_addresslab mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.height.mas_equalTo(35);
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(self.lineV4.mas_bottom).offset(10);
    }];
    
    [self.addresslab mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.height.mas_equalTo(35);
        make.left.mas_equalTo(self.t_addresslab.mas_right).offset(10);
        make.top.equalTo(self.t_addresslab);
    }];
    
    [self.t_numberlab mas_makeConstraints:^(MASConstraintMaker *make) {
      
        make.height.mas_equalTo(35);
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(self.t_addresslab.mas_bottom).offset(5);
        
    }];
    
    [self.numberlab mas_makeConstraints:^(MASConstraintMaker *make) {
      
        make.height.mas_equalTo(35);
        make.left.mas_equalTo(self.t_numberlab.mas_right).offset(10);
        make.top.equalTo(self.t_numberlab);
        
    }];
    
    [self.t_getNumberAddresslab mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.height.mas_equalTo(35);
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(self.t_numberlab.mas_bottom).offset(5);

    }];
    
    [self.getNumberAddresslab mas_makeConstraints:^(MASConstraintMaker *make) {
     
        make.height.mas_equalTo(35);
        make.left.mas_equalTo(self.t_getNumberAddresslab.mas_right).offset(10);
        make.top.equalTo(self.t_getNumberAddresslab);
        
    }];
    
    [self.lineV5 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.getNumberAddresslab.mas_bottom).offset(5);
        make.left.right.mas_equalTo(0);
        make.height.mas_equalTo(1);
    }];
    
//#warning  **************【 第六个模块 】**********************
   
    [self.reSendMsgBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.height.mas_equalTo(45);
        make.bottom.mas_equalTo(-20);
        make.left.mas_equalTo(20);
        make.right.mas_equalTo(self.view.mas_centerX).offset(-20);
        
    }];
    
    [self.cancelApplyBtn  mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.height.mas_equalTo(45);
        make.bottom.mas_equalTo(-20);
        make.right.mas_equalTo(-20);
        make.left.mas_equalTo(self.view.mas_centerX).offset(20);

        
    }];
    
    

}

//#pragma mark  - ACtions
- (void)clickBtn:(UIButton *)btn{

    if (btn.tag == 101) {
    
        loggerWarn(@"短信重发");
    }else if(btn.tag == 102){
    
        loggerWarn(@"取消预约");
    }else{
    
        loggerWarn(@"递交反馈");
    }
}


@end
